<template>
  <view >
  <view class="container-box" v-for="(item,index) in list" :key="item.id">
    <view class="item">
      <!-- 头部标题 -->
      <view class="item-top">
        <u--image :showLoading="true" :src="item.tpImg" width="40px" height="40px" shape="circle"></u--image>
        <text>{{item.tpTitle}} </text>
      </view>
      <!-- 中间图片 -->
      <view class="item-img">
        <image class="item-img-img" :src="item.img" mode=""></image>
      </view>
      <!-- 下方信息 -->
      <view class="item-text">
        <text>{{item.bmText}}</text>
      </view>
    </view>
  </view>
  </view>
</template>

<script>
  export default {
    name:"CyTitle",
    data() {
      return {
        list:[]
      };
    },
    created(){
      // 获取社区的信息
      this.getCommunityList()
    },
    methods:{
      async getCommunityList(){
        const {data:res} = await uni.$http.get('/community')
        if(res.code !== 200) uni.$showMsg("数据获取失败")
        this.list = res.data.records
      }
    }
  }
</script>

<style lang="scss">
page{
  background-color: #F8F8F8;
  .container-box{
    margin: 10px 10px 20px 10px;
    border-radius: 5px;
    background-color: white;
    display: flex;
    flex-direction: column;
    .item{
      .item-top{
        display: flex;
        justify-content: flex-start;
        align-items: center;
        padding-bottom: 10px;
        margin-left: 10px;
        margin-top: 5px;
        text{
          padding-left: 20px;
          font-family:黑体;
          color:midnightblue;
        }
      }
      .item-img{
            height: 150px;
            width: 100%;
            padding-bottom: 10px;
        .item-img-img{
          height: 100%;
          width: 100%;
        }
      }
      .item-text{
        padding: 0 0 20px 20px;
        font-size: 16px;
        font-weight: 100;
        color: black;
      }
    }
  }
}
</style>